Page({
  data: {
    notificationEnabled: true,
    cacheSize: '12.5MB',
  },

  changePhoneNumber() {
    wx.navigateTo({
      url: 'sjh/sjh',
    })
  },

  changePassword() {
    wx.navigateTo({
      url: 'mima/mima',
    })
  },

  toggleNotification(e) {
    this.setData({
      notificationEnabled: e.detail.value
    })
    wx.showToast({
      title: this.data.notificationEnabled ? '通知已开启' : '通知已关闭',
      icon: 'none'
    })
  },

  clearCache() {
    wx.showLoading({
      title: '清理中',
    })
    setTimeout(() => {
      this.setData({ cacheSize: '0MB' })
      wx.hideLoading()
      wx.showToast({
        title: '缓存已清除',
        icon: 'success'
      })
    }, 1000)
  },

  checkUpdate() {
    wx.showToast({
      title: '已是最新版本',
      icon: 'none'
    })
  },

  aboutUs() {
    wx.navigateTo({
      url: '/pages/about/about',
    })
  },

  logout() {
    wx.showModal({
      title: '提示',
      content: '确定要退出登录吗？',
      success: (res) => {
        if (res.confirm) {
          // 这里执行退出登录的逻辑
          // wx.setStorageSync('userid', 0),
          // wx.setStorageSync('token', '');
          // wx.setStorageSync('avator', '')
          // wx.setStorageSync('name', '')
          
          wx.removeStorageSync('token')
          wx.removeStorageSync('userid')
          wx.removeStorageSync('avator')
          wx.removeStorageSync('name')
          wx.showToast({
            title: '已退出登录',
            icon: 'success'
          })
          setTimeout(() => {
            wx.reLaunch({
              url: '/pages/login/login',
            })
          }, 1500)
        }
      }
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options){

  }



})
